﻿using System;

namespace DevelopTool.Model
{
    /// <summary>
    /// DataGridView列信息
    /// </summary>
    [Serializable]
    public class DataGridColumn
    {

        public DataGridColumn()
        {

        }

        public DataGridColumn(string columnName)
        {
            ColumnName = columnName;
        }

        /// <summary>
        /// 列名（数据列名）
        /// </summary>
        public string ColumnName { get; set; }


        /// <summary>
        /// 列名文本（界面显示列名）
        /// </summary>
        public string ColumnText { get; set; }

        /// <summary>
        /// 列宽度,设置为-1时，将根据列名内容长度自动设置宽度。 设置为0时，自动沾满剩余宽度，设置为其它值时，则使用设置的宽度。默认为0
        /// </summary>
        public int Width { get; set; } = 0;

        /// <summary>
        /// 显示窗口的属性
        /// </summary>
        public ShowFormProperty ShowFormProperty { get; set; }

        /// <summary>
        /// 值格式化 例如：yyyy-MM-dd HH:mm:ss
        /// </summary>
        public string ValueFormat { get; set; }

        /// <summary>
        /// 列类型
        /// </summary>
        public ColumnType ColumnType { get; set; } = ColumnType.None;
    }


    /// <summary>
    /// 显示窗口的属性
    /// </summary>
    [Serializable]
    public class ShowFormProperty
    {
        /// <summary>
        /// 主列的值，用于显示标题
        /// </summary>
        public string BaseNameColumn { get; set; }

        /// <summary>
        /// 文本内容的类型，默认为sql
        /// </summary>
        public string TextType { get; set; } = "SQL";

        /// <summary>
        /// 超过指定字符长度才显示
        /// </summary>
        public int ShowTextLength { get; set; } = 0;
    }


    /// <summary>
    /// 列类型
    /// </summary>
    [Flags]
    public enum ColumnType
    {
        /// <summary>
        /// 无
        /// </summary>
        None = 0,

        /// <summary>
        /// 可点击获取值列
        /// </summary>
        CanClick = 1,

        /// <summary>
        /// 重要列
        /// </summary>
        Important = 2,

        /// <summary>
        /// 长文本列
        /// </summary>
        LongText = 4,

        /// <summary>
        /// 隐藏列
        /// </summary>
        Hide = 8,

        /// <summary>
        /// 行头列
        /// </summary>
        RowMain = 16,

        /// <summary>
        /// 默认查询列
        /// </summary>
        DefaultFilter = 32
    }

}
